package com.github.baichuan.application.scaffold.rest.jpa.app;

import com.github.baichuan.application.scaffold.rest.domain.app.App;
import com.github.baichuan.application.scaffold.rest.domain.application.Application;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Optional;

public interface AppRepository extends JpaRepository<App, String>, JpaSpecificationExecutor<App> {

    @Query("select app from App app where application=:application and code=:code and platform=:platform")
    Optional<App> find(@Param("application") Application application, @Param("platform") App.Platform platform, @Param("code") String code);
}
